package com.tour.bean;

import java.io.Serializable;

/**
 * @ClassName ReturnT
 * @Author 张梦兴
 * @Date 2020/3/13 18:00
 * @describe
 */
public class ReturnT<T> implements Serializable {
    public static final long serialVersionUID = 1L;

    public static final int SUCCESS_CODE = 200;
    public static final int FAIL_CODE = 500;
    public static final ReturnT<String> SUCCESS = new ReturnT<>(SUCCESS_CODE,"SUCCESS");
    public static final ReturnT<String> FAIL = new ReturnT<>(FAIL_CODE, "FAIL");

    private int code;
    private String msg;
    private T data;

    public ReturnT(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ReturnT(T data) {
        this.code = SUCCESS_CODE;
        this.msg="SUCCESS";
        this.data = data;
    }

    public ReturnT(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
